package com.springboot.test.web.app;

import com.springboot.test.common.response.Response;
import com.springboot.test.service.RegisterService;
import com.springboot.test.service.param.RegisterParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 注册接口
 */
@RestController
@RequestMapping("app/register")
public class RegisterController {

    @Resource
    private RegisterService registerService;

    /**
     * 发送验证码
     * @param phone
     * @return
     */
    @GetMapping("send")
    public Response<Void> sendMsg(String phone){
        registerService.send(phone);
        return Response.success();
    }

    @PostMapping("register")
    public Response<Void> register(@RequestBody RegisterParam param){
        registerService.register(param);
        return Response.success();
    }
}
